#ifndef L298_H
#define L298_H
#include <Arduino.h>
#include <math.h>
/*
  channel 0: IN1, IN2 , maybe left wheel
  channel 1: IN3, IN4 , maybe right wheel
*/
class L298
{
    private:
        const char IN1; // connect to positive pin which motor go forward
        const char IN2; // connect to negative pin which motor go forward
        const char IN3; // connect to positive pin which motor go forward
        const char IN4; // connect to negative pin which motor go forward
        const char ENA;
        const char ENB;
    public:
        L298(char in1, char in2, char in3, char in4, char ena, char enb);
        void run(float dir, float oil);
        // argument dir's rough definition is
        // the direction of motion curve's tangent at midpoint of front wheel
        // under polar coordinate system, 0 <= direction <= 360.
        // 0 <= oil <= 1
        void feed(char channel, int speed);
        void brake(char channel);
};
#endif
